﻿using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using MS.InformationManagement.Presenter.InclurRadicadoRecord;
using MS.InformationManagement.Presenter.Support;
using MS.InformationManagement.Support;

namespace MS.InformationManagement.WP.Layouts.MS.InformationManagement.WP
{
    public partial class AddFileToRecord : BaseApplicationPage, IIncluirRadicadoRecordView
    {

        #region fields

        IncluirRadicadoRecordPresenter _presenter;

        #endregion

        #region Properties

        public string RadicadoId { get { return Page.Request.QueryString["RadicadoId"]; } }
        public string ExpedienteId { get { return Page.Request.QueryString["ExpedienteId"]; } }
        public string CurrentListId { get { return Page.Request.QueryString["ListId"]; } }

        #endregion

        #region form events

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            lblMessage.Text = "Este documento ha sido cargado al expediente fisico ?";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                _presenter = new IncluirRadicadoRecordPresenter(this);
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }

        }

        protected void Action_Ok(object sender, EventArgs e)
        { 
            try
            {
                _presenter.Incluir();
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }

        protected void Action_Cancel(object sender, EventArgs e)
        {
            this.CloseWindow(true);
        }

        #endregion

        #region Implemented Methods

        public void close()
        {
            this.CloseWindow(true);
        }

        #endregion

    }
}
